home *** CD-ROM | disk | FTP | other *** search
- /*
- * A Drawing Mode for ImageFX 1.5
- *
- */
-
- #include <exec/types.h>
- #include <scan/modall.h>
-
- #define MAX(a,b) ((a) > (b) ? (a) : (b))
-
- /**********************************************************************\
-
- Library Vectors
-
- \**********************************************************************/
-
- short mix = 255;
-
- int __asm DM_PutInit (void)
- {
- return(1);
- }
-
- void __asm DM_PutCleanup (void)
- {
- }
-
- void __asm DM_PutColor (register __a0 short *destr,
- register __a1 short *destg,
- register __a2 short *destb,
- register __d0 LONG oldr,
- register __d1 LONG oldg,
- register __d2 LONG oldb,
- register __d3 LONG newr,
- register __d4 LONG newg,
- register __d5 LONG newb,
- register __d6 LONG x,
- register __d7 LONG y)
- {
- *destr = mixer(newr, oldr, mix);
- *destg = mixer(newg, oldg, mix);
- *destb = mixer(newb, oldb, mix);
- }
-
- void __asm DM_PutGrey (register __a0 short *destg,
- register __d0 LONG oldg,
- register __d1 LONG newg,
- register __d6 LONG x,
- register __d7 LONG y)
- {
- *destg = mixer(newg, oldg, mix);
- }
-
- /*
- * You cannot rely on this being called after DM_PutInit(), or
- * vice versa.
- *
- * x, y, and z will be -1 if the drawing tool in question is
- * not a curve (eg. a box or something).
- *
- */
- void __asm DM_NewPoint (register __d0 int n,
- register __d1 int total,
- register __d2 int x,
- register __d3 int y,
- register __d4 int z)
- {
- /* This is called at every point along a user-drawn curve. */
-
- if (x >= 0) {
- mix = n * 255 / total;
- }
- else {
- mix = 255;
- }
- }
-
- /**********************************************************************\
-
- Library Initialization Stuff
-
- \**********************************************************************/
-
- /*
- * This is the table of all the functions that can be called in this
- * module. The first four (Open, Close, Expunge, and Null) are reserved
- * for system use and MUST be specified in the order shown. The actual
- * functions are in the standard module startup code.
- */
- ULONG FuncTable[] = {
- /* These four MUST be present in this order */
- (ULONG) LibOpen,
- (ULONG) LibClose,
- (ULONG) LibExpunge,
- (ULONG) LibNull,
-
- /* Specific to the module */
- (ULONG) DM_PutInit,
- (ULONG) DM_PutCleanup,
- (ULONG) DM_PutColor,
- (ULONG) DM_PutGrey,
- (ULONG) DM_NewPoint,
-
- /* End with -1L */
- (ULONG) -1L
- };
-
- /*
- * These are used by the standard module startup code.
- * LibraryName is the name of the library, and LibraryID is a short
- * description of the library. Both of these are largely irrelavent,
- * but they are included just for completeness.
- */
- UBYTE LibraryID[] = "$VER: Trail Drawing Mode 1.04.05 (12.6.93)";
- UBYTE LibraryType = NT_DRAWMODE;
-
- /*
- * This is called by the standard module startup code when Image Scan
- * first opens the module. Here we should fill in the NumGads,
- * NewGad, Language, and LangCount fields of the provided ModuleBase
- * structure if necessary.
- */
- long __asm UserOpen (register __a6 struct ModuleBase *modbase)
- {
- return(TRUE);
- }
-
- /*
- * This is called by the standard module startup code when Image Scan
- * closes the module. It should cleanup anything allocated or obtained
- * in the UserOpen() function.
- */
- long __asm UserClose (register __a6 struct ModuleBase *modbase)
- {
- return(TRUE);
- }
-
-